<template>
  <div class="page_root" :key="queryUpdateFlag" data-page-name="外部需求变更审批详情页" data-page-identification="t_0qmx2r0fpk">
    <a-spin :spinning="pageLoading.loading" :tip="pageLoading.tip">
      <!-- begin vid_a66h2jgxek 容器_ak0v3kpvfq -->
      <al-box class="vid_a66h2jgxek">
        <!-- begin vid_y0icqw7s0k 容器_r0x7u07rjc -->
        <al-box class="vid_y0icqw7s0k">
          <!-- begin vid_4zyqhg08mk 布局容器_3yebd0mnmk -->
          <a-row class="vid_4zyqhg08mk" :gutter="24" :slots="'20:4'">
            <a-col :span="20">
              <!-- begin vid_cm9pflrc0j 容器_8qf9lf61mf -->
              <al-box class="vid_cm9pflrc0j">
                <!-- begin vid_qda7xszz78 容器_pa5tx52lro -->
                <al-box class="vid_qda7xszz78">
                  <!-- begin vid_sfilmvv65x 外部需求变更详情 -->
                  <span class="vid_sfilmvv65x"> 外部需求变更详情 </span>
                  <!-- end vid_sfilmvv65x 外部需求变更详情 -->
                </al-box>
                <!-- end vid_qda7xszz78 容器_pa5tx52lro -->
                <!-- begin vid_tco3wjhp43 布局容器_zspt10zfad -->
                <a-row class="vid_tco3wjhp43" :gutter="16" :slots="'6:6:6:6'">
                  <a-col :span="6">
                    <!-- begin vid_agftkz8uz8 项目名称： -->
                    <span class="vid_agftkz8uz8"> 项目名称： </span>
                    <!-- end vid_agftkz8uz8 项目名称： -->
                    <!-- begin vid_8o2vce0kw8 这里是项目名称 -->
                    <span class="vid_8o2vce0kw8">
                      {{ renderStringInTemplate(vid_8o2vce0kw8_props.rt_text) }}
                    </span>
                    <!-- end vid_8o2vce0kw8 这里是项目名称 -->
                  </a-col>
                  <a-col :span="6">
                    <!-- begin vid_j524s44y14 项目优先级： -->
                    <span class="vid_j524s44y14"> 项目优先级： </span>
                    <!-- end vid_j524s44y14 项目优先级： -->
                    <!-- begin vid_8qq5mxkl1m 文本 -->
                    <span class="vid_8qq5mxkl1m">
                      {{ renderStringInTemplate(vid_8qq5mxkl1m_props.rt_text) }}
                    </span>
                    <!-- end vid_8qq5mxkl1m 文本 -->
                  </a-col>
                  <a-col :span="6">
                    <!-- begin vid_k21zr4bl1f 提交人： -->
                    <span class="vid_k21zr4bl1f"> 提交人： </span>
                    <!-- end vid_k21zr4bl1f 提交人： -->
                    <!-- begin vid_kj1lebglxb 简单文本_eeuxwukphf -->
                    <span class="vid_kj1lebglxb">
                      {{ renderStringInTemplate(vid_kj1lebglxb_props.rt_text) }}
                    </span>
                    <!-- end vid_kj1lebglxb 简单文本_eeuxwukphf -->
                  </a-col>
                  <a-col :span="6">
                    <!-- begin vid_ll362ryyaq 提交时间： -->
                    <span class="vid_ll362ryyaq"> 提交时间： </span>
                    <!-- end vid_ll362ryyaq 提交时间： -->
                    <!-- begin vid_0a5ny7bhqr 简单文本_nd8ikks682 -->
                    <span class="vid_0a5ny7bhqr">
                      {{ renderStringInTemplate(vid_0a5ny7bhqr_props.rt_text) }}
                    </span>
                    <!-- end vid_0a5ny7bhqr 简单文本_nd8ikks682 -->
                  </a-col>
                </a-row>
                <!-- end vid_tco3wjhp43 布局容器_zspt10zfad -->
              </al-box>
              <!-- end vid_cm9pflrc0j 容器_8qf9lf61mf -->
            </a-col>
            <a-col :span="4">
              <!-- begin vid_yc0o12sjf3 容器_osafwbszt5 -->
              <al-box class="vid_yc0o12sjf3">
                <!-- begin vid_z5d21gc5ca 投入工时评估 -->
                <span class="vid_z5d21gc5ca"> 投入工时评估 </span>
                <!-- end vid_z5d21gc5ca 投入工时评估 -->
              </al-box>
              <!-- end vid_yc0o12sjf3 容器_osafwbszt5 -->
              <!-- begin vid_r7nzjd47j6 容器_lbe8czjzns -->
              <al-box class="vid_r7nzjd47j6">
                <!-- begin vid_iaxza1lxsm 简单文本_knc2q7kvqc -->
                <span class="vid_iaxza1lxsm">
                  {{ renderStringInTemplate(vid_iaxza1lxsm_props.rt_text) }}
                </span>
                <!-- end vid_iaxza1lxsm 简单文本_knc2q7kvqc -->
                <!-- begin vid_mlvja35ter 小时 -->
                <span class="vid_mlvja35ter"> 小时 </span>
                <!-- end vid_mlvja35ter 小时 -->
              </al-box>
              <!-- end vid_r7nzjd47j6 容器_lbe8czjzns -->
            </a-col>
          </a-row>
          <!-- end vid_4zyqhg08mk 布局容器_3yebd0mnmk -->
        </al-box>
        <!-- end vid_y0icqw7s0k 容器_r0x7u07rjc -->
        <!-- begin vid_10z7otxrcx 容器_0vprbr076f -->
        <al-box class="vid_10z7otxrcx">
          <!-- begin vid_lg8s6v29zu 容器_qmktx09sbc -->
          <al-box class="vid_lg8s6v29zu">
            <!-- begin vid_cc32235apl 项目附件 -->
            <span class="vid_cc32235apl"> 项目附件 </span>
            <!-- end vid_cc32235apl 项目附件 -->
          </al-box>
          <!-- end vid_lg8s6v29zu 容器_qmktx09sbc -->
          <!-- begin vid_st5qey5hwy 布局容器_3iwaxrq86l -->
          <a-row class="vid_st5qey5hwy" :slots="'24'">
            <a-col :span="24">
              <!-- begin vid_vummuwedad For循环_ti3lmpffop -->
              <al-cycle
                v-if="vid_vummuwedad_props.dataSource?.length"
                class="vid_vummuwedad"
                v-model:dataSource="vid_vummuwedad_props.dataSource"
                v-model:current="vid_vummuwedad_props.current"
                v-model:currentIndex="vid_vummuwedad_props.currentIndex"
              >
                <template #default="vid_vummuwedad_dataItem">
                  <!-- begin vid_o7dlrbs06m 按钮_6i5pl895w3 -->
                  <a-button :data-cycle-index="vid_vummuwedad_dataItem.cycleIndex" class="vid_o7dlrbs06m" :type="'link'" @click="handle_vid_o7dlrbs06m_click">
                    {{ renderStringInTemplate(vid_vummuwedad_dataItem.dataItem.name) }}
                  </a-button>
                  <!-- end vid_o7dlrbs06m 按钮_6i5pl895w3 -->
                </template>
              </al-cycle>
              <!-- end vid_vummuwedad For循环_ti3lmpffop -->
            </a-col>
          </a-row>
          <!-- end vid_st5qey5hwy 布局容器_3iwaxrq86l -->
        </al-box>
        <!-- end vid_10z7otxrcx 容器_0vprbr076f -->
        <!-- begin vid_sfxoib0dkn 容器_orrmghb9ty -->
        <al-box class="vid_sfxoib0dkn">
          <!-- begin vid_k7uubnujuf 容器_acgemovqq5 -->
          <al-box class="vid_k7uubnujuf">
            <!-- begin vid_njv7qlilk7 需求变更描述 -->
            <span class="vid_njv7qlilk7"> 需求变更描述 </span>
            <!-- end vid_njv7qlilk7 需求变更描述 -->
          </al-box>
          <!-- end vid_k7uubnujuf 容器_acgemovqq5 -->
          <!-- begin vid_oohzvn6iz2 文本域_y9zy67u66g -->
          <a-textarea class="vid_oohzvn6iz2" v-model:value="vid_oohzvn6iz2_props.value" :disabled="true" :autoSize="true" :allowClear="true"> </a-textarea>
          <!-- end vid_oohzvn6iz2 文本域_y9zy67u66g -->
        </al-box>
        <!-- end vid_sfxoib0dkn 容器_orrmghb9ty -->
        <!-- begin vid_sby2qmv3ab 容器_ud7t5qwq3b -->
        <al-box class="vid_sby2qmv3ab">
          <!-- begin vid_sjbtvv323e 容器_ij9bgny0q8 -->
          <al-box class="vid_sjbtvv323e">
            <!-- begin vid_qdwklb8cfs 外部影响评估 -->
            <span class="vid_qdwklb8cfs"> 外部影响评估 </span>
            <!-- end vid_qdwklb8cfs 外部影响评估 -->
          </al-box>
          <!-- end vid_sjbtvv323e 容器_ij9bgny0q8 -->
          <!-- begin vid_65uquekvdn 文本域_rj79cd4owu -->
          <a-textarea class="vid_65uquekvdn" v-model:value="vid_65uquekvdn_props.value" :disabled="true" :autoSize="true" :allowClear="true"> </a-textarea>
          <!-- end vid_65uquekvdn 文本域_rj79cd4owu -->
        </al-box>
        <!-- end vid_sby2qmv3ab 容器_ud7t5qwq3b -->
        <!-- begin vid_ypcafr2zgv 容器_zj5vfnpepr -->
        <al-box class="vid_ypcafr2zgv">
          <!-- begin vid_p57mjxpend 容器_r0zs6apuge -->
          <al-box class="vid_p57mjxpend">
            <!-- begin vid_mtrzarqdl8 事项关联依赖 -->
            <span class="vid_mtrzarqdl8"> 事项关联依赖 </span>
            <!-- end vid_mtrzarqdl8 事项关联依赖 -->
          </al-box>
          <!-- end vid_p57mjxpend 容器_r0zs6apuge -->
          <!-- begin vid_0f6axpv973 文本域_t1whzv3im3 -->
          <a-textarea class="vid_0f6axpv973" v-model:value="vid_0f6axpv973_props.value" :disabled="true" :autoSize="true" :allowClear="true"> </a-textarea>
          <!-- end vid_0f6axpv973 文本域_t1whzv3im3 -->
        </al-box>
        <!-- end vid_ypcafr2zgv 容器_zj5vfnpepr -->
        <!-- begin vid_m5rzd4ttug 容器_9vxq7rcwi5 -->
        <al-box class="vid_m5rzd4ttug">
          <!-- begin vid_7k4iehehhd 容器_q8wqn1jrv4 -->
          <al-box class="vid_7k4iehehhd">
            <!-- begin vid_wdam2ovhfy 其他影响说明 -->
            <span class="vid_wdam2ovhfy"> 其他影响说明 </span>
            <!-- end vid_wdam2ovhfy 其他影响说明 -->
          </al-box>
          <!-- end vid_7k4iehehhd 容器_q8wqn1jrv4 -->
          <!-- begin vid_zpxjuequd1 文本域_x4ox1d3roc -->
          <a-textarea class="vid_zpxjuequd1" v-model:value="vid_zpxjuequd1_props.value" :disabled="true" :autoSize="true" :allowClear="true"> </a-textarea>
          <!-- end vid_zpxjuequd1 文本域_x4ox1d3roc -->
        </al-box>
        <!-- end vid_m5rzd4ttug 容器_9vxq7rcwi5 -->
      </al-box>
      <!-- end vid_a66h2jgxek 容器_ak0v3kpvfq -->
    </a-spin>
  </div>
</template>
<script setup lang="tsx">
  import {
      h, ref, reactive, toRaw, markRaw, watch, computed,
      onBeforeMount, onMounted, onBeforeUnmount, onUnmounted, onActivated, onDeactivated
    } from "vue";
    import { useRoute, useRouter } from 'vue-router';
    const router = useRouter();
    const route = useRoute();
    import { get, post, put, del, request, requestWithHeaders } from '@/utils/http/Axios';
    import { cloneDeep, localGet, merge, getDifferenceArray, traversalTreeStructure, checkCaseCondition, renderStringInTemplate, handleBreadcrumbJump, throttle, permission, getComponentParamsValue } from '@/utils/index';
    import { isNullOrEmpty, isEmptyArr, isNullOrUnDef, isContained, isArray, isEmpty, isObject } from '@/utils/is';
    import dayjs from 'dayjs';
    import { getPagePcChartsDataSourceConvert } from '@/utils/chart';
    import { message, notification, Modal } from 'ant-design-vue'
    import { propertyFormatByNumber, propertyFormatByPercentage, propertyFormatByDate, parseSubFromDataList } from '@/utils/format';
    import colorTheme from '@/design/custom-theme.json';
    
    import UserTableRecords from '@/model/UserTableRecords';
    import { getAppBaseUrl } from '@/utils/index';
    import { sendToken } from "@/hooks/useIframeToken";
    import { useSystemStore } from "@/store/modules/system";
    const systemStore = useSystemStore();
    



      // 获取传入的流程ID和组件参数
      const props = defineProps({
            'processInstanceId': {
            type: [String,Number,Boolean],
            default: undefined,
        },
      })
      const immediateWatch = (source, callback) => {
        watch(source, callback, {deep: true,immediate: true })
      }



  /* -------------------------- 属性定义 -------------------------- */

      const setTimeOutList = [];
      const pageLoading = reactive({
        loading: false,
        tip: undefined
      });
      const authInfo = localGet('app-user-store');

    const vid_8o2vce0kw8_props = reactive({
          rt_text: undefined,
  })

    const vid_8qq5mxkl1m_props = reactive({
          rt_text: undefined,
  })

    const vid_kj1lebglxb_props = reactive({
          rt_text: undefined,
  })

    const vid_0a5ny7bhqr_props = reactive({
          rt_text: undefined,
  })

    const vid_iaxza1lxsm_props = reactive({
          rt_text: undefined,
  })

    const vid_vummuwedad_props = reactive({
          dataSource: [{"imgUrl":"","uid":"","size":-1,"name":"","enclosureId":-1,"delFlag":-1,"type":"","projectId":-1,"url":"","status":""}],
      current: {"imgUrl":"","uid":"","size":-1,"name":"","enclosureId":-1,"delFlag":-1,"type":"","projectId":-1,"url":"","status":""},
      currentIndex: -1,
  })

    const vid_o7dlrbs06m_props = reactive({
          rt_text: undefined,
  })

    const vid_oohzvn6iz2_props = reactive({
          value: undefined,
  })

    const vid_65uquekvdn_props = reactive({
          value: undefined,
  })

    const vid_0f6axpv973_props = reactive({
          value: undefined,
  })

    const vid_zpxjuequd1_props = reactive({
          value: undefined,
  })



      // 处理校验
      const setSubFormName =(parentInfo, name)=>{
        return [parentInfo.parents, parentInfo.cycleIndex, name];
      }


  /* ========================== 属性定义 ========================== */


  /* -------------------------- 元素数据引用 -------------------------- */


  /* ========================== 元素数据引用 ========================== */


  /* -------------------------- 页面数据 -------------------------- */

    // 页面数据 模版审批详情表格
    const dataConnector_conn_4asfe9dzf2_response = ref();
    const dataConnector_conn_4asfe9dzf2 = async (additionParams = {}) => {
        const exec = async () => {
          // 获取参数
          const params = {

          };

          // 注入附加的参数
          try {
            merge(params, additionParams);
          } catch (error) {
            console.log(error)
          }

          // 判断加载提示

          // 处理URL
          let url = '/solution-ppm/api/v2/built-in-system-ppm/project/template/{instanceId}/approval_detail';
          // 替换url中的变量
          url = url.replace('{instanceId}', String(pageParameter_state.processInstanceId))
          // 排除空参数  日期组件重置后的空参数是[null] 或者[undefined]
          Object.keys(params).forEach(key=>{ if(params[key] === null){ delete params[key] }else if( Object.prototype.toString.call(params[key]) === '[object Object]' ){ Object.keys(params[key]).forEach(childKey=>{ if(params[key][childKey] === null || (Array.isArray(params[key][childKey]) && params[key][childKey].length === 1 && isNullOrUnDef(params[key][childKey]?.[0]))){ delete params[key][childKey] }}) } });
          return get(url, params, {
                headers: undefined
              }).then(async (resp) => {
            dataConnector_conn_4asfe9dzf2_response.value = resp;

            return resp;
          }).catch(async (e) => {


            return Promise.reject(e);
          }).finally(async () => {


          })
        }

          return await exec()

    }


    // 页面数据 需求变更审批详情
    const dataConnector_conn_ljpv9gpc4m_response = ref();
    const dataConnector_conn_ljpv9gpc4m = async (additionParams = {}) => {
        const exec = async () => {
          // 获取参数
          const params = {

          };

          // 注入附加的参数
          try {
            merge(params, additionParams);
          } catch (error) {
            console.log(error)
          }

          // 判断加载提示

          // 处理URL
          let url = '/solution-ppm/api/v2/built-in-system-ppm/v2/reqChange/{instanceId}';
          // 替换url中的变量
          url = url.replace('{instanceId}', String(pageParameter_state.processInstanceId))
          // 排除空参数  日期组件重置后的空参数是[null] 或者[undefined]
          Object.keys(params).forEach(key=>{ if(params[key] === null){ delete params[key] }else if( Object.prototype.toString.call(params[key]) === '[object Object]' ){ Object.keys(params[key]).forEach(childKey=>{ if(params[key][childKey] === null || (Array.isArray(params[key][childKey]) && params[key][childKey].length === 1 && isNullOrUnDef(params[key][childKey]?.[0]))){ delete params[key][childKey] }}) } });
          return post(url, params, {
                headers: undefined
              }).then(async (resp) => {
            dataConnector_conn_ljpv9gpc4m_response.value = resp;

            return resp;
          }).catch(async (e) => {


            return Promise.reject(e);
          }).finally(async () => {


          })
        }

          return await exec()

    }


  /* ========================== 页面数据 ========================== */



  /* -------------------------- 响应 -------------------------- */

  /* ========================== 响应 ========================== */


  /* -------------------------- 函数 -------------------------- */

    // 自定义函数 下载文件
    const customFunction_394q85h3u9 =  (params) => {
      let xhr = new XMLHttpRequest();
      xhr.open('GET', vid_vummuwedad_props.current.url, true);
      xhr.responseType = 'blob';
      xhr.onload = function () {
        if (xhr.status === 200) {
          if (window.navigator.msSaveOrOpenBlob) {
            navigator.msSaveBlob(xhr.response, vid_vummuwedad_props.current.name);
          } else {
            let link = document.createElement('a');
            let body = document.querySelector('body');
            link.href = window.URL.createObjectURL(xhr.response);
            link.download = vid_vummuwedad_props.current.name;
            // fix Firefox
            link.style.display = 'none';
            body.appendChild(link);
            link.click();
            body.removeChild(link);
            window.URL.revokeObjectURL(link.href);
          }
        }
      };
      xhr.send();
    }

  /* ========================== 函数 ========================== */


  /* -------------------------- 页面参数 -------------------------- */

    const pageParameter_state = reactive({
        'processInstanceId': props.processInstanceId ?? route.query.processInstanceId,
    })

  /* ========================== 页面参数 ========================== */


  /* -------------------------- 组件事件处理方法 -------------------------- */

    // ---------------------------- 组件数据同步 ----------------------------
    // 处理 这里是项目名称 的 rt_text 属性关联
  watch(() => dataConnector_conn_ljpv9gpc4m_response?.value?.data?.projectName,
    () => {
      let dataList = dataConnector_conn_ljpv9gpc4m_response?.value?.data?.projectName

      vid_8o2vce0kw8_props.rt_text = dataList;
    },
    {deep: true})
  // 处理 文本 的 rt_text 属性关联
  watch(() => dataConnector_conn_ljpv9gpc4m_response?.value?.data?.projectPriority,
    () => {
      let dataList = dataConnector_conn_ljpv9gpc4m_response?.value?.data?.projectPriority

      vid_8qq5mxkl1m_props.rt_text = dataList;
    },
    {deep: true})
  // 处理 简单文本_eeuxwukphf 的 rt_text 属性关联
  watch(() => dataConnector_conn_ljpv9gpc4m_response?.value?.data?.updateBy,
    () => {
      let dataList = dataConnector_conn_ljpv9gpc4m_response?.value?.data?.updateBy

      vid_kj1lebglxb_props.rt_text = dataList;
    },
    {deep: true})
  // 处理 简单文本_nd8ikks682 的 rt_text 属性关联
  watch(() => dataConnector_conn_ljpv9gpc4m_response?.value?.data?.updateTime,
    () => {
      let dataList = dataConnector_conn_ljpv9gpc4m_response?.value?.data?.updateTime

      vid_0a5ny7bhqr_props.rt_text = dataList;
    },
    {deep: true})
  // 处理 简单文本_knc2q7kvqc 的 rt_text 属性关联
  watch(() => dataConnector_conn_ljpv9gpc4m_response?.value?.data?.workHourEval,
    () => {
      let dataList = dataConnector_conn_ljpv9gpc4m_response?.value?.data?.workHourEval

      vid_iaxza1lxsm_props.rt_text = dataList;
    },
    {deep: true})
  // 处理 For循环_ti3lmpffop 的 systemList 属性关联
  watch(() => dataConnector_conn_ljpv9gpc4m_response?.value?.data?.attachmentList,
    () => {
      let dataList = dataConnector_conn_ljpv9gpc4m_response?.value?.data?.attachmentList

      vid_vummuwedad_props.dataSource = dataList;
    },
    {deep: true})
  // 处理 文本域_y9zy67u66g 的 value 属性关联
  watch(() => dataConnector_conn_ljpv9gpc4m_response?.value?.data?.demandChangeDesc,
    () => {
      let dataList = dataConnector_conn_ljpv9gpc4m_response?.value?.data?.demandChangeDesc

      vid_oohzvn6iz2_props.value = dataList;
    },
    {deep: true})
  // 处理 文本域_rj79cd4owu 的 value 属性关联
  watch(() => dataConnector_conn_ljpv9gpc4m_response?.value?.data?.extInfluenceAssessment,
    () => {
      let dataList = dataConnector_conn_ljpv9gpc4m_response?.value?.data?.extInfluenceAssessment

      vid_65uquekvdn_props.value = dataList;
    },
    {deep: true})
  // 处理 文本域_t1whzv3im3 的 value 属性关联
  watch(() => dataConnector_conn_ljpv9gpc4m_response?.value?.data?.itemRelationDependency,
    () => {
      let dataList = dataConnector_conn_ljpv9gpc4m_response?.value?.data?.itemRelationDependency

      vid_0f6axpv973_props.value = dataList;
    },
    {deep: true})
  // 处理 文本域_x4ox1d3roc 的 value 属性关联
  watch(() => dataConnector_conn_ljpv9gpc4m_response?.value?.data?.otherImpactDesc,
    () => {
      let dataList = dataConnector_conn_ljpv9gpc4m_response?.value?.data?.otherImpactDesc

      vid_zpxjuequd1_props.value = dataList;
    },
    {deep: true})
    // ============================ 组件数据同步 ============================

  /**
  * 处理元素 按钮 的 click 事件
  */
  let handle_vid_o7dlrbs06m_click = throttle(async (...params) => {
  customFunction_394q85h3u9();
  }, 500)
  /* ========================== 组件事件处理方法 ========================== */


  /* -------------------------- 生命周期 -------------------------- */
  // 用于参数变更后重新执行自定义指令
      const queryUpdateFlag = ref(0);
      onMounted(() => { ;dataConnector_conn_4asfe9dzf2()
  dataConnector_conn_ljpv9gpc4m()

    });

    onUnmounted(() => {
      // 销毁定时器
      setTimeOutList.forEach(({ repeat, timer }) => {
        repeat ?  clearInterval(timer): clearTimeout(timer);
      });
    });

  /* ========================== 生命周期 ========================== */


  /* -------------------------- 数据关联处理 -------------------------- */





  /* -------------------------- 表单数据同步 -------------------------- */
  /* ========================== 表单数据同步 ========================== */

  /* ========================== 数据关联处理 ========================== */


  /* -------------------------- 不同组件自定义的处理逻辑 -------------------------- */

  /* ========================== 不同组件自定义的处理逻辑 ========================== */


  // ================================定制化逻辑========================================
  const state = reactive({
    templateDetailList: [],
    tableProps: {
      columns: [
        {
          title: "项目阶段",
          dataIndex: "stageName",
          ellipsis: true,
          align: "left",
          width: "140px",
          fixed: "left",
          customCell: (item) => {
            const { rowIndex, rowSpan } = item;
            return {
              rowSpan: rowSpan,
              style: {
                fontSize: "16px",
                color: "#262626",
                fontWeight: "600",
                borderTop: rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "任务序号",
          dataIndex: "serialNumber",
          ellipsis: true,
          align: "center",
          width: "100px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "任务名称",
          dataIndex: "taskName",
          ellipsis: true,
          align: "center",
          width: "100px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "完成标准",
          dataIndex: "finishStandard",
          ellipsis: true,
          align: "center",
          width: "100px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "审核标准",
          dataIndex: "assessorStandard",
          ellipsis: true,
          align: "center",
          width: "100px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "注意事项",
          dataIndex: "note",
          ellipsis: true,
          align: "center",
          width: "100px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "甲方工作事项",
          dataIndex: "workItem",
          ellipsis: true,
          align: "center",
          width: "150px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "任务负责人（角色）",
          dataIndex: "directorRole",
          ellipsis: true,
          align: "center",
          width: "150px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "审核员（角色）",
          dataIndex: "auditorRole",
          ellipsis: true,
          align: "center",
          width: "100px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "开始时间",
          dataIndex: "periodClassifyStart",
          ellipsis: true,
          align: "center",
          width: "100px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "结束时间",
          dataIndex: "periodClassifyEnd",
          ellipsis: true,
          align: "center",
          width: "100px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "人天",
          dataIndex: "workingHours",
          ellipsis: true,
          align: "center",
          width: "80px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "模板附件",
          dataIndex: "attachmentList",
          ellipsis: true,
          align: "center",
          width: "140px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "标记",
          dataIndex: "mark",
          ellipsis: true,
          align: "center",
          width: "80px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
        {
          title: "备注",
          dataIndex: "description",
          ellipsis: true,
          align: "center",
          width: "80px",
          customCell: ({ rowSpan, rowIndex, border }) => {
            return {
              style: {
                borderTop: border && rowIndex ? "1px solid #3875ff" : "none"
              }
            };
          }
        },
      ],
      formatColumnsList: ["finishStandard", "assessorStandard", "note", "workItem"]
    },
  });
  function handleTaskResizeColumn(w, col) {
    col.width = w;
  }

  const scrollX = state.tableProps.columns.reduce((pre, cur) => {
    return parseInt(pre.width) + parseInt(cur.width)
  }, {})

  const formatStringBySemi = (string) => {
    if (typeof string !== "string") {
      string = String(string);
    }
    return string.split(/;|；/);
  };
  function groupData(data) {
    let stageName = "";
    if (!data || !data.length) {
      return [];
    }
    return data.map((item, index) => {
      if (stageName !== item.stageName) {
        stageName = item.stageName;
        let rowSpan = 0;
        for (let i = 0; i < data.length; i++) {
          if (i >= index) {
            if (stageName === data[i].stageName) {
              rowSpan += 1;
            } else {
              break;
            }
          }
        }
        item.rowSpan = rowSpan;
        item.border = index;
      } else {
        item.rowSpan = 0;
      }
      item.rowIndex = index;
      return item;
    });
  }

  function getTableData() {
    get(`/solution-ppm/api/v2/built-in-system-ppm/project/template/${String(pageParameter_state.processInstanceId)}/approval_detail_list`).then(res => {
      state.templateDetailList = groupData(res.data);
    })
  }
  onMounted(() => {
    getTableData();
  })
  function downloadFile(info) {
    const { name, url } = info;
    let xhr = new XMLHttpRequest();
    xhr.open("GET", url, true);
    xhr.responseType = "blob";
    xhr.onload = function() {
      if (xhr.status === 200) {
        if (window.navigator.msSaveOrOpenBlob) {
          navigator.msSaveBlob(xhr.response, name);
        } else {
          let link = document.createElement("a");
          let body = document.querySelector("body");
          link.href = window.URL.createObjectURL(xhr.response);
          link.download = name;
          // fix Firefox
          link.style.display = "none";
          body.appendChild(link);
          link.click();
          body.removeChild(link);
          window.URL.revokeObjectURL(link.href);
        }
      }
    };
    xhr.send();
  }
</script>
<style lang="less" scoped>
  .page_root {
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color:#F5F5F5;
  }
  .page_root :deep(.@{ant-prefix}-spin-nested-loading),
  .page_root :deep(.@{ant-prefix}-spin-container)
   {
      height: 100%;
  }
  .page_root :deep(.@{ant-prefix}-spin-container .@{ant-prefix}-table-wrapper)
   {
      display: flex;
      flex-flow: column nowrap;
      justify-content: flex-start;
  }
  .page_root :deep(.@{ant-prefix}-table)
   {
    flex: auto;
    overflow: auto;
  }
  .table-moreBtn_down {
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 100px;
  }

  .table-moreBtn_menu :deep(.table-moreBtn_menu-item):hover {
    background: #ebf1ff;
  }

  /*  表格树结构样式处理，展开按钮层级增加*/
  :deep(.@{ant-prefix}-table-row-expand-icon) {
    z-index: 1;
  }
  /*  表格树结构 由于每个表格项采用自定义组件，使用绝对定位布局，开启树结构导致显示异常，暂时使用层级定位位置 */
  :deep(.@{ant-prefix}-table-row-level-1 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 15px !important;
    width: calc(100% - 15px);
  }
  :deep(.@{ant-prefix}-table-row-level-2 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 30px !important;
    width: calc(100% - 30px);
  }
  :deep(.@{ant-prefix}-table-row-level-3 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 45px !important;
    width: calc(100% - 45px);
  }
  :deep(.@{ant-prefix}-table-row-level-4 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 60px !important;
    width: calc(100% - 60px);
  }

  /* 穿梭框改变默认样式，为根据组件样式控制左右栏宽度。 */
  :deep(.@{ant-prefix}-transfer-list)
   {
      height: 100%;
      width: 50%;
  }
  .vid_a66h2jgxek{
      width:100%;
      height:750px;
      overflow-x:hidden;
      overflow-y:auto;
      display:block;
      background-color:#FFFFFF;
      box-shadow:0px 0px 0px 0px
  }
  .vid_y0icqw7s0k{
      display:block;
      margin-bottom:16px;
      box-shadow:0px 0px 0px 0px
  }
  .vid_cm9pflrc0j{
      display:block;
      box-shadow:0px 0px 0px 0px
  }
  .vid_qda7xszz78{
      margin-bottom:16px;
      background-color:#FFFFFF
  }
  .vid_sfilmvv65x{
      padding-left:8px;
      font-weight:600;
      color:rgba(38, 38, 38, 1);
      font-size:16px;
      line-height:16px;
      border-left-style:solid;
      border-left-width:4px;
      border-left-color:#3875FF
  }
  .vid_tco3wjhp43{
      display:flex;
      flex-direction:row;
      align-items:flex-start;
      flex-wrap:undefined;
      box-shadow:0px 0px 0px 0px
  }
  .vid_agftkz8uz8{
      min-width:70px;
      font-weight:400;
      color:rgba(89, 89, 89, 1)
  }
  .vid_8o2vce0kw8{
      font-weight:600;
      color:rgba(38, 38, 38, 1)
  }
  .vid_j524s44y14{
      font-weight:400;
      color:rgba(89, 89, 89, 1)
  }
  .vid_8qq5mxkl1m{
      font-weight:600;
      color:rgba(38, 38, 38, 1)
  }
  .vid_k21zr4bl1f{
      font-weight:400;
      color:rgba(89, 89, 89, 1)
  }
  .vid_kj1lebglxb{
      font-weight:600;
      color:rgba(38, 38, 38, 1)
  }
  .vid_ll362ryyaq{
      font-weight:400;
      color:rgba(89, 89, 89, 1)
  }
  .vid_0a5ny7bhqr{
      font-weight:600;
      color:rgba(38, 38, 38, 1)
  }
  .vid_yc0o12sjf3{
      margin-bottom:16px;
      background-color:#FFFFFF
  }
  .vid_z5d21gc5ca{
      padding-left:8px;
      font-weight:800;
      color:rgba(38, 38, 38, 1);
      font-size:16px;
      line-height:16px;
      border-left-style:solid;
      border-left-width:4px;
      border-left-color:#3875FF
  }
  .vid_r7nzjd47j6{
      display:flex;
      align-items:center;
      flex-wrap:undefined;
      padding-left:16px
  }
  .vid_iaxza1lxsm{
      font-weight:600;
      color:rgba(56, 117, 255, 1);
      font-size:24px;
      box-shadow:0px 0px 0px 0px
  }
  .vid_mlvja35ter{
      font-weight:500;
      color:rgba(56, 117, 255, 1);
      font-size:18px;
      box-shadow:0px 0px 0px 0px
  }
  .vid_10z7otxrcx{
      display:block;
      margin-bottom:24px;
      box-shadow:0px 0px 0px 0px
  }
  .vid_lg8s6v29zu{
      margin-bottom:16px;
      background-color:#FFFFFF
  }
  .vid_cc32235apl{
      padding-left:8px;
      font-weight:600;
      color:rgba(38, 38, 38, 1);
      font-size:16px;
      line-height:16px;
      border-left-style:solid;
      border-left-width:4px;
      border-left-color:#3875FF
  }
  .vid_st5qey5hwy{
      display:flex;
      flex-wrap:undefined;
      background-color:#FFFFFF;
      border-style:solid;
      border-width:1px;
      border-color:#D9D9D9;
      border-radius:2px
  }
  .vid_vummuwedad{
      width:100%;
      overflow-y:auto;
      display:flex;
      flex-direction:column;
      align-items:flex-start;
      flex-wrap:undefined
  }
  .vid_o7dlrbs06m{
      margin-left:8px
  }
  .vid_sfxoib0dkn{
      display:block;
      margin-bottom:24px;
      box-shadow:0px 0px 0px 0px
  }
  .vid_k7uubnujuf{
      margin-bottom:16px;
      background-color:#FFFFFF
  }
  .vid_njv7qlilk7{
      padding-left:8px;
      font-weight:600;
      color:rgba(38, 38, 38, 1);
      font-size:16px;
      line-height:16px;
      border-left-style:solid;
      border-left-width:4px;
      border-left-color:#3875FF
  }
  .vid_oohzvn6iz2{
      max-height:300px;
      overflow-y:auto;
      box-shadow:0px 0px 0px 0px
  }
  .vid_sby2qmv3ab{
      display:block;
      margin-bottom:16px;
      box-shadow:0px 0px 0px 0px
  }
  .vid_sjbtvv323e{
      margin-bottom:16px;
      background-color:#FFFFFF
  }
  .vid_qdwklb8cfs{
      padding-left:8px;
      font-weight:600;
      color:rgba(38, 38, 38, 1);
      font-size:16px;
      line-height:16px;
      border-left-style:solid;
      border-left-width:4px;
      border-left-color:#3875FF
  }
  .vid_65uquekvdn{
      max-height:300px;
      overflow-y:auto;
      box-shadow:0px 0px 0px 0px
  }
  .vid_ypcafr2zgv{
      display:block;
      margin-bottom:24px;
      box-shadow:0px 0px 0px 0px
  }
  .vid_p57mjxpend{
      margin-bottom:16px;
      background-color:#FFFFFF
  }
  .vid_mtrzarqdl8{
      padding-left:8px;
      font-weight:600;
      color:rgba(38, 38, 38, 1);
      font-size:16px;
      line-height:16px;
      border-left-style:solid;
      border-left-width:4px;
      border-left-color:#3875FF
  }
  .vid_0f6axpv973{
      max-height:300px;
      overflow-y:auto;
      box-shadow:0px 0px 0px 0px
  }
  .vid_m5rzd4ttug{
      display:block;
      margin-bottom:24px;
      box-shadow:0px 0px 0px 0px
  }
  .vid_7k4iehehhd{
      margin-bottom:16px;
      background-color:#FFFFFF
  }
  .vid_wdam2ovhfy{
      padding-left:8px;
      font-weight:600;
      color:rgba(38, 38, 38, 1);
      font-size:16px;
      line-height:16px;
      border-left-style:solid;
      border-left-width:4px;
      border-left-color:#3875FF
  }
  .vid_zpxjuequd1{
      overflow-y:auto;
      box-shadow:0px 0px 0px 0px
  }

  .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table-thead) > tr {
        height: 40px;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table-thead) > tr > th {
        background: #3875FF;
        font-size: 14px;
        font-family: arial, helvetica, "microsoft yahei";;
        font-weight: 600;
        color: #FFFFFF;
        border-bottom:1px solid #3875ff;
        padding: 8px 16px;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table.@{ant-prefix}-table-bordered) .@{ant-prefix}-table-container .@{ant-prefix}-table-thead > tr:not(:last-child) > th {
        border-bottom:1px solid #D9D9D9;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table.@{ant-prefix}-table-bordered) .@{ant-prefix}-table-container .@{ant-prefix}-table-thead > tr > th {
        border-right:1px solid #D9D9D9;
      }
      /* 将表格自带的左边框取消，方便设置表头边框颜色和内容边框颜色 */
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table.@{ant-prefix}-table-bordered) .@{ant-prefix}-table-container {
        border-left: none;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table.@{ant-prefix}-table-bordered) .@{ant-prefix}-table-container .@{ant-prefix}-table-thead > tr > th[colstart='0']:first-child {
        border-left:1px solid #D9D9D9;
      }
      /* 开启粘性表头后，表格结构会发生变化 需另外处理 */
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table.@{ant-prefix}-table-bordered) .@{ant-prefix}-table-container .@{ant-prefix}-table-header table {
        border-top:1px solid #D9D9D9;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table.@{ant-prefix}-table-bordered) .@{ant-prefix}-table-container > .@{ant-prefix}-table-content > table {
        border-top:1px solid #D9D9D9;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table-thead) > tr > th:not(:last-child):not(.@{ant-prefix}-table-selection-column):not(.@{ant-prefix}-table-row-expand-icon-cell):not([colspan])::before {
        background: #D9D9D9;
        width: 1px;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table-cell-scrollbar) {
        box-shadow: none;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table-tbody) tr {
        height: 40px;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table-tbody) tr > td {
        font-size: 14px;
        font-family: arial, helvetica, "microsoft yahei";;
        font-weight: 400;
        color: #262626;
        border-bottom:1px solid #EBEBEB;
        padding: 0 16px;
        word-break: break-all;
        .cell-wrapper {
          padding: 0 16px;
        }
      }

      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table-tbody) tr > td .cell-wrapper {
        padding: 0 16px;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table-empty .@{ant-prefix}-table-tbody tr > td) {
        padding: 0;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table-tbody) tr > td .@{ant-prefix}-btn {
        padding: 0 30px 0 0;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table-tbody) tr > td .@{ant-prefix}-btn:last-child {
        padding: 0;
      }
      .vid_a7g6eyj5wh :deep(.table-striped-odd) td {
        background-color: #FFFFFF;
      }
      .vid_a7g6eyj5wh :deep(.table-striped-even) td {
        background-color: #FAFAFA;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table.@{ant-prefix}-table-bordered) .@{ant-prefix}-table-container .@{ant-prefix}-table-tbody tr > td {
        border-right:1px solid #EBEBEB;
      }
      .vid_a7g6eyj5wh :deep(.@{ant-prefix}-table.@{ant-prefix}-table-bordered) .@{ant-prefix}-table-container .@{ant-prefix}-table-tbody tr > td:first-child {
        border-left:1px solid #EBEBEB;
      }
      .vid_a7g6eyj5wh{
        width: 100%;
        height:100%
      }


    .table-text {
      min-width:70px;
      text-overflow:ellipsis;
      white-space:nowrap;
      overflow:hidden;
    }

    .table-text.red {
      color: #F5222D;
    }
</style>